﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Globalization;
using System.Web.Security;

namespace Pr0ject0.Models
{
    public class JobApplicationModel
    {
        [Key]
        [Required]
        [Display(Name = "Application ID")]
        public int ID { get; set; }

        [Required]
        [Display(Name = "First Name")]
        public string first { get; set; }

        [Required]
        [Display(Name = "Last Name")]
        public string last { get; set; }

        [Display(Name = "Middle Name")]
        public string middle { get; set; }

        [Display(Name = "Address")]
        public string address1 { get; set; }
        [Display(Name = "Address cont.")]
        public string address2 { get; set; }
        [Display(Name = "City")]
        public string city { get; set; }
        [Display(Name = "State")]
        public string state { get; set; }
        [Display(Name = "Zip Code")]
        public int? zip { get; set; }

        [Display(Name = "Phone Number")]
        public long? phone { get; set; }

        public int jobID { get; set; }

        public int status { get; set; }

        public List<PreviousJobModel> previousJobs { get; set; }
        public List<EducationModel> education { get; set; }
        public List<ReferenceModel> references { get; set; }
        public AvailableHoursModel hours { get; set; }
        public List<AnswerModel> answers { get; set; }


        public void setAppinfo()
        {

        }

        public void save()
        {

        }

        public void getAppinfo()
        {

        }

        public void cascadeIDSet(int id)
        {
            ID = id;
            hours.ID = id;
            if (education != null)
            {
                foreach (EducationModel e in education)
                {
                    e.ID = id;
                }
            }

            if (previousJobs != null)
            {
                foreach (PreviousJobModel p in previousJobs)
                {
                    p.ID = id;
                }
            }

            if (references != null)
            {
                foreach (ReferenceModel r in references)
                {
                    r.AppId = id;
                }
            }

            if (answers != null)
            {
                foreach (AnswerModel a in answers)
                {
                    a.appId = id;
                }
            }
        }
    }
}